Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

copy-styles

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

copy-styles

Copies computed styles from source to target

  • 1.1.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

computed-style

NPM version Build Status Downloads

Copies computed styles from source DOM Element to target DOM Element as inline styles.

Install

npm install Hypercubed/copy-styles

Usage

import copyStyles from 'copy-styles';

const source = document.querySelector('#node1');
const target = document.querySelector('#node1');

copyStyles(source, target);
Styles object

An optional third parameter can be passed to copyStyles. If true all computed styles are copied. If false no styles are copied (function has no effect). If the third parameter is an object only those keys with a truthy value are copied. If a value is false or equal to the value of the that property it will not be copied. For example:

copyStyles(source, target,{
	'color': true,
	'font-family': false,
	'margin-left': '0px'
});

In this case, the color style will be copied, font-family will not (same result if font-family is absent), margin-left will only be copied if not equal to '0px'.

See API

License

MIT © J. Harshbarger

Keywords

FAQs

Package last updated on 20 Oct 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc